﻿<!DOCTYPE html>
<html lang="zh">

<head resource>
    <meta charset="utf-8">
    <include file="../inc/meta.inc" />   
    <title>考试中...</title>
</head>

<body>
    <div id="vapp" v-cloak>
        <van-loading type="spinner" class="loading_init" v-if="loading.init" size="24px">加载初始数据...</van-loading>
        <div v-if="!loading.init && !examstate.doing" class="context" remark="无法考试的各种原因">
            <template v-if="!examstate.islogin">
                <card>
                    <card-title>
                        <span icon="&#xe748" @click="window.history.go(-1);"></span>
                        学员登录后才能考试！
                    </card-title>
                    <card-context>
                        <div class="acc_photo nophoto"></div>
                        <div class="accInfo null_icon">
                            <div class="acc-name"> <a :href="commonaddr('signin')">点击此处登录 </a>
                            </div>
                            <span class="acc-money"> ... </span>
                        </div>
                    </card-context>
                </card>
            </template>
            <template v-else-if="!examstate.exist">
                <card>
                    <card-title>
                        <span icon="&#xe748" @click="window.history.go(-1);"></span>
                        当前考试不存在，或考试被禁！
                    </card-title>
                    <card-context>
                        <div class="null_icon" icon="&#xe849">
                            没有内容
                        </div>
                    </card-context>
                </card>
            </template>
            <template v-else-if="!loading.exam" remark="考试存在">
                <card>
                    <card-title><span icon="&#xe748"
                            @click="window.history.go(-1);"></span>《{{exam.Exam_Name}}》
                    </card-title>
                    <card-context>
                        <row>时间：
                            <span v-if="exam.Exam_DateType==1">
                                <!--准时开始-->
                                {{starttime|date("yyyy-M-dd HH:mm:ss")}} （准时开始）
                            </span>
                            <span v-else>
                                <!--区间时间-->
                                {{exam.Exam_Date|date("yyyy-M-dd HH:mm")}} 至
                                {{exam.Exam_DateOver|date("yyyy-M-dd HH:mm")}} 之间
                            </span>
                        </row>
                        <row v-if="paper">限时：{{exam.Exam_Span}}分钟 （共 {{paper.Tp_Count}} 道试题）</row>
                        <row>总分：{{exam.Exam_Total}}分（{{paper.Tp_PassScore}}分及格）</row>
                        <row>专业：{{subject.Sbj_Name}} </row>
                        <row>课程：{{paper.Cou_Name}}</row>
                    </card-context>
                </card>
                <template v-if="!examstate.allow">
                    <card>
                        <card-title>
                            <span icon="&#xe6bd"></span> 不需要参加此次考试
                        </card-title>
                        <card-context>
                            <div class="null_icon" icon="&#xe60e">
                                您不在考试人员范围内！
                            </div>
                        </card-context>
                    </card>
                </template>
                <template v-else-if="examstate.issubmit">
                    <card>
                        <card-title> <span icon="&#xe6bd"></span>您已经交过卷了
                        </card-title>
                        <card-context>
                            <div class="null_icon" icon="&#xe654" @click="goreviwe">
                                点击此处查看成绩！
                            </div>
                        </card-context>
                    </card>
                </template>
                <template v-else-if="examstate.isover">
                    <card>
                        <card-title>
                            <span icon="&#xe6bd"></span>考试时间已过
                        </card-title>
                        <card-context>
                            <div class="null_icon" icon="&#xe854">
                                好像错过了什么！
                            </div>
                        </card-context>
                    </card>
                </template>
                <template v-else-if="!examstate.isstart">
                    <card>
                        <card-title> <span icon="&#xe6bd"></span>还没有开始
                            <van-tag type="success" style="float:right">开始时间：{{starttime|date('HH:mm:ss')}}</van-tag>
                        </card-title>
                        <card-context>
                            <div class="time_icon" icon="&#xe671">
                                <van-tag type="primary">当前时间</van-tag> <br />{{nowtime|date('yyyy-MM-dd HH:mm:ss')}}
                                <br />
                                <van-tag type="danger">距离开考</van-tag> <br />{{howtime}}
                            </div>
                        </card-context>
                    </card>
                </template>
            </template>
        </div>

        <template v-if="!loading.init && examstate.doing" mark="允许考试时，才输出">
            <header>
                <div icon="&#xe748" @click="window.history.go(-1);"></div>
                <div class="title" @click="showExam=true">{{exam.Exam_Name}}</div>
                <div icon="&#xe81a" @click="showTime=true">
                    {{surplustime|surplus}}
                </div>
            </header>
            <footer>
                <div id="btnCard" icon="&#xe75e" @click="showCard=true">
                    <span>{{answertotal}}</span>/<span>{{questotal}}</span>
                </div>
                <div id="btnSubmit" icon="&#xe6cf" @click="submitManual">
                    交&nbsp;卷</div>
            </footer>


            <section :style="'width:'+questotal*100+'vw'" v-swiperight="swiperight" v-swipeleft="swipeleft"
                remark="试题区域">
                <template v-if="loading.paper">
                    <dl v-for="(group,i) in paperQues" :style="'width:'+group.count*100+'vw'">
                        <question v-for="(q,n) in group.ques" :ques="q" :index="n" :groupindex="i" :types="types">
                        </question>
                    </dl>
                </template>
                <div class="loading_paper" v-else>
                    <van-loading type="spinner" size="24px">试题加载中...</van-loading>
                </div>
            </section>

            <van-popup v-model="showCard" position="left" closeable class="quesCard" :overlay="false" remark="答题卡">
                <div class="cardTit">
                    <span icon="&#xe75e">答题卡</span>
                    <span>完成<b>{{answertotal}}</b>道 / 共<b>{{questotal}}</b>道</span>
                </div>
                <div class="cardBox">
                    <dl v-for="(group,i) in paperAnswer.ques">
                        <dt icon="&#xe6bd"> [ {{types[group.type - 1]}}题 ]
                            <span>每题{{Math.floor(group.number/group.count*100)/100}}分/共{{group.number}}分</span>
                        </dt>
                        <dd v-for="(q,n) in group.q" @click="swipe(calcIndex(n,i))" :ans="q.ans!=''">

                            {{calcIndex(n,i)+1}}

                        </dd>
                    </dl>
                </div>
            </van-popup>
            <van-popup v-model="showTime" class="showTime" ramark="时间信息">
                <row>当前时间： {{nowtime|date("yyyy-MM-dd HH:mm:ss")}}</row>
                <row>开始时间： {{time.begin|date("yyyy-MM-dd HH:mm:ss")}}</row>
                <row>结束时间： {{time.over|date("yyyy-MM-dd HH:mm:ss")}}</row>
                <row>考试时限： {{time.span}} 分钟</row>
                <row>剩余时间： {{surplustime|surplus}}</row>
            </van-popup>
            <van-popup v-model="showExam" class="showExam" ramark="考试信息">
                <card>
                    <card-title>《{{exam.Exam_Name}}》
                    </card-title>
                    <card-context>
                        <row>时间：
                            <span v-if="exam.Exam_DateType==1">
                                <!--准时开始-->
                                {{exam.Exam_Date|date("yyyy-M-dd HH:mm")}} （准时开始）
                            </span>
                            <span v-else>
                                <!--区间时间-->
                                {{exam.Exam_Date|date("yyyy-M-dd HH:mm")}} 至
                                {{exam.Exam_DateOver|date("yyyy-M-dd HH:mm")}} 之间
                            </span>
                        </row>
                        <row v-if="paper">限时：{{exam.Exam_Span}}分钟</row>
                        <row>题量：{{paper.Tp_Count}}道</row>
                        <row>总分：{{exam.Exam_Total}}分（{{paper.Tp_PassScore}}分及格）</row>
                        <row>专业：{{subject.Sbj_Name}} </row>
                        <row>课程：{{paper.Cou_Name}}</row>
                    </card-context>
                </card>
            </van-popup>
            <van-popup v-model="submitState.show" class="submitState" :close-on-click-overlay="false">
                <van-loading size="24px" v-if="submitState.loading">考试成绩提交中...</van-loading>
                <result :state="submitState" :exam="exam" :paper="paper"> </result>
            </van-popup>
    </div>

    </template>

</body>

</html>